<?php

class Smer extends BaseSmer
{
    public function __toString()
    {
        return $this->getNaziv();
    }

    public function getTipString()
    {
        return array_search($this->getTip(),SmerPeer::getTips());
    }

    public function getPredmets()
    {
        $i_obj = sfContext::getInstance()->getI18N();
        $predmet_arr = array();
        $predmet_arr[''] = sfContext::getInstance()->getI18N()->__("Izaberi");
        $predmets = $this->getPredmetSmersJoinPredmet();
        foreach($predmets as $predmet)
          $predmet_arr[$predmet->getPredmet()->getId()] = $predmet->getPredmet();
        return $predmet_arr;
    }

    public function getPredmetFulls()
    {
        $i_obj = sfContext::getInstance()->getI18N();
        $predmet_arr = array();
        $predmet_arr[''] = sfContext::getInstance()->getI18N()->__("Izaberi");
        $predmets = $this->getPredmetSmersJoinPredmet();
        foreach($predmets as $predmet)
          $predmet_arr[$predmet->getPredmet()->getId()] = $predmet->getPredmet()->getPredmetNaziv();
        return $predmet_arr;
    }

    public function getPredmetIzbornog()
    {
        return DbFinder::from('Predmet')->where('Predmet', $this->getNaziv())->findOne();
    }

}
